package com.atguigu.jxc.controller;

import com.atguigu.jxc.service.GoodsAllUnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @description 商品单位Controller
 */
@RestController
@RequestMapping("/unit")
public class GoodsAllUnitController {

    @Autowired
    GoodsAllUnitService goodsAllUnitService;

    /*查询所有商品单位
    * 请求URL：http://localhost:8080/unit/list
        请求参数：无
        请求方式：POST
        * 返回值类型：JSON
        返回值：Map<String,Object>
    * */
    @PostMapping("/list")
    @ResponseBody
    public Map<String,Object> getGoodsAllUnit(){
        return goodsAllUnitService.getGoodsAllUnit();
    }
}
